package agent;

import gui.threed.AgentModel;
import gui.threed.LabyrinthModel;

import java.awt.event.KeyListener;

import javax.media.j3d.Node;
import javax.vecmath.Color3f;

import labyrinth.Map;
import agent.moves.IAgentMove;

/**
 * The abstract class describing agents
 * 
 * @author Johannes Kulick
 * @version 0.1
 * @licence GNU Lesser Genaral Public Licence
 */
public abstract class IAgent {
	/**
	 * This function will called to get the next move the agent want to make.
	 * Here you should put all your pathfinding logic.
	 * 
	 * @param position
	 *            A map of all known labyrinth fields. Depending on the
	 *            specified difficulty the agent sees more or less fields.
	 * 
	 * @return The next desired move the agent want to make
	 */
	abstract public IAgentMove getNextMove(Map position, IAgentMove move);

	/**
	 * Every Agent should have a name. If you don't overwrite this method it
	 * will be the class name.
	 * 
	 * @return the name of the agent
	 */
	public String toString() {
		return this.getClass().getName();
	}

	/**
	 * Returns the 3D model of the agent. Normally this is a simple sphere. You
	 * can override this function to give your a better look.
	 * 
	 * @return An AgentModel object representing the look of the agent
	 */
	public Node getModel() {
		return new AgentModel(new Color3f(1f, 0, 0));
	}

	/**
	 * Return the height of your model. You should override this, if you
	 * override getModel() to get your model correct displayed
	 * 
	 * @return the height of your model
	 */
	public float getModelHeight() {
		return LabyrinthModel.BLOCK_SIZE / 0.75f;
	}
	
	public boolean isHuman() {
		if(this instanceof KeyListener) return true;
		else return false;
	}
}
